<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>业务表管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        $(document).ready(function () {
            $("body").addClass("gray-bg");
        });

        function page(n, s) {
            if (n) $("#pageNo").val(n);
            if (s) $("#pageSize").val(s);
            $("#searchForm").submit();
            return false;
        }
    </script>
</head>


<body>

<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="ibox-title">
            <h5>业务表单列表 </h5>
        </div>
        <div class="ibox-content">

            <!-- 0:隐藏tip, 1隐藏box,不设置显示全部 -->
            <script type="text/javascript">top.$.jBox.closeTip();</script>

            <!-- 查询条件 -->
            <div class="row">
                <div class="col-sm-12">
                        <form:form id="searchForm" modelAttribute="genTable" action="${ctx}/gen/genTable/" method="post" class="breadcrumb form-search">
                            <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
                            <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}" />
                            <sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();" />
                            <label>表名：</label>
                            <form:input path="nameLike" htmlEscape="false" maxlength="50" class="input-medium" />
                            <label>说明：</label>
                            <form:input path="comments" htmlEscape="false" maxlength="50" class="input-medium" />
                            <label>父表表名：</label>
                            <form:input path="parentTable" htmlEscape="false" maxlength="50" class="input-medium" /> &nbsp;
                            <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" />
                        </form:form>
                    <br>
                </div>
            </div>

            <sys:message content="${message}" />
            <!-- 工具栏 -->
            <div class="row">
                <div class="col-sm-12">
                    <div class="pull-left">
                        <a href="${ctx}/gen/genTable/form" class="btn btn-white btn-sm"><i class="fa fa-plus"></i> 创建表单</a>
                        <button class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="left" onclick="add()"
                                title="添加"><i class="fa fa-plus"></i> 添加
                        </button>

                        <script type="text/javascript">
                            function add() {
                                if ('' == null || '' == '') {
                                    openDialog("新增" + '表单', "/jf/gen/genTable/form", "800px", "500px", "");
                                } else {
                                    window.location = "/jf/gen/genTable/form";
                                }
                            }
                        </script>

                        <button class="btn btn-white btn-sm " data-toggle="tooltip" data-placement="left"
                                onclick="sortOrRefresh()" title="刷新"><i class="fa fa-repeat"></i> 刷新
                        </button>
                    </div>
                    <div class="pull-right">
                        <button class="btn btn-primary btn-rounded btn-outline btn-sm " onclick="search()"><i
                                class="fa fa-search"></i> 查询
                        </button>
                        <button class="btn btn-primary btn-rounded btn-outline btn-sm " onclick="reset()"><i
                                class="fa fa-refresh"></i> 重置
                        </button>
                    </div>
                </div>
            </div>

            <!-- 表格 -->
            <table id="contentTable"
                   class="table table-striped table-bordered table-hover table-condensed dataTables-example dataTable">
                <thead>
                <tr>
                    <th><input type="checkbox" class="i-checks"></th>
                    <th class="sort-column name">表名</th>
                    <th>说明</th>
                    <th class="sort-column class_name">类名</th>
                    <th class="sort-column parent_table">父表</th>
                    <%--<th>操作</th>--%>
                    <shiro:hasPermission name="gen:genTable:edit">
                        <th>操作</th>
                    </shiro:hasPermission>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${page.list}" var="genTable">
                    <tr>
                        <td><input type="checkbox" id="${genTable.id}" class="i-checks"></td>
                        <td><a href="${ctx}/gen/genTable/form?id=${genTable.id}">${genTable.name}</a></td>
                        <td>${genTable.comments}</td>
                        <td>${genTable.className}</td>
                        <td title="点击查询子表"><a href="javascript:" onclick="$('#parentTable').val('${genTable.parentTable}');$('#searchForm').submit();">${genTable.parentTable}</a></td>
                        <shiro:hasPermission name="gen:genTable:edit">
                            <%--<td>--%>
                                <%--<a href="${ctx}/gen/genTable/form?id=${genTable.id}">修改</a>--%>
                                <%--<a href="${ctx}/gen/genTable/delete?id=${genTable.id}" onclick="return confirmx('确认要删除该业务表吗？', this.href)">删除</a>--%>
                            <%--</td>--%>

                            <td>
                                <a href="${ctx}/gen/genTable/form?id=${genTable.id}" class="btn btn-success btn-xs"><i class="fa fa-edit"></i> 修改</a>
                                <a href="${ctx}/gen/genTable/delete?id=${genTable.id}" onclick="return confirmx('确认要删除该业务表吗？', this.href)" class="btn btn-danger btn-xs"><i class="fa fa-trash"></i> 删除</a>
                                <a href="${ctx}/gen/genScheme/toForm?genTable.Id=${genTable.id}" class="btn btn-primary btn-xs"><i class="fa fa-edit"></i> 生成代码</a>
                                <a href="#" onclick="openDialog('生成菜单', '${ctx}/gen/genScheme/menuForm?genTableId=${genTable.id}','800px', '500px')" class="btn btn-info btn-xs"><i class="fa fa-edit"></i> 生成菜单</a>
                            </td>
                        </shiro:hasPermission>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
            <!-- 分页代码 -->

            <div class="fixed-table-pagination" style="display: block;">${page}</div>


            <!-- pagination的css样式设定-->
            <style>
                .fixed-table-pagination div.pagination,
                .fixed-table-pagination div.pagination-roll,
                .fixed-table-pagination .pagination-detail {
                    margin-top: 0px;
                    margin-bottom: 10px;
                }

                .fixed-table-pagination div.pagination-roll .pagination,
                .fixed-table-pagination div.pagination .pagination {
                    margin: 0;
                }

                .fixed-table-pagination .pagination a {
                    padding: 6px 12px;
                    line-height: 1.428571429;
                }

                .fixed-table-pagination .pagination-info {
                    line-height: 34px;
                    margin-right: 5px;
                }

                .fixed-table-pagination .btn-group {
                    position: relative;
                    display: inline-block;
                    vertical-align: middle;
                }

                .fixed-table-pagination .dropup .dropdown-menu {
                    margin-bottom: 0;
                }

                .fixed-table-pagination .page-list {
                    display: inline-block;
                }

            </style>
            <br>
        </div>
    </div>
</div>

<script type="text/javascript">//<!-- 无框架时，左上角显示菜单图标按钮。
if (!(self.frameElement && self.frameElement.tagName == "IFRAME")) {
    $("body").prepend("<i id=\"btnMenu\" class=\"icon-th-list\" style=\"cursor:pointer;float:right;margin:10px;\"></i><div id=\"menuContent\"></div>");
    $("#btnMenu").click(function () {

        top.layer.open({
            type: 2,
            area: ['300px', '350px'],
            content: 'get:/jf/sys/menu/treeselect;JSESSIONID=cea992bd87dc47b691486b23ac42ec3e' //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
        });
        //top.$.jBox('get:/jf/sys/menu/treeselect;JSESSIONID=cea992bd87dc47b691486b23ac42ec3e', {title:'选择菜单', buttons:{'关闭':true}, width:300, height: 350, top:10});
        //if ($("#menuContent").html()==""){$.get("/jf/sys/menu/treeselect", function(data){$("#menuContent").html(data);});}else{$("#menuContent").toggle(100);}
    });
}//-->
</script>

</body>
</html>
